<script>
/**
*	公共的录入页
*/
$(document).ready(function(){
	{params}
	var c = {
		num:'',
		cnum:'',
		funitid:'',
		istan:function(){
			return params.ismodal;
		},
		init:function(){
			this.num 	= params.num;
			this.mid 	= params.mid;
			this.name 	= params.name;
			this.data   = params.data; //录入页的默认的数据
			if(params.cnum)this.cnum 	= params.cnum;
			if(params.funitid)this.funitid 	= params.funitid;
			
			importjs('input', function(){c.loadinput();});
			var obj = $('#inputtitle{rand}');
			if(this.istan()){
				js.input.resize(this.num);
				obj.hide();
			}else{
				obj.html(this.name);
				this.resize();
				xcy.resieze=function(){
					c.resize();
				}
			}
		},
		closetan:function(){
			if(this.istan()){
				js.input.close(this.num);
			}
			var call = params.callback;
			if(call){
				try{window[call](params);}catch(e){}
			}
			var tabid = params.tableid;
			if(tabid){
				if(js.table){
					try{
						var obj = js.table.getobj(tabid);
						if(obj)obj.reload();
					}catch(e){}
				}else{
					try{
						var obj = opener.js.table.getobj(tabid);
						if(obj)obj.reload();
					}catch(e){}
				}
			}
		},
		resize:function(){
			var hei = viewheight - 140;
			$('#inputviews{rand}').css('height',''+hei+'px');
		},
		submit:function(o1){
			if(this.inputobj)this.inputobj.submit(o1);
		},
		loadinput:function(){
			js.ajax.get({
				url:'api/flow/input?num='+this.num+'&mid='+this.mid+'',
				cnum:this.cnum,
				funitid:this.funitid,
				onsuccess:function(ret){
					c.loadshow(ret.data);
				},
				onerror:function(ret){
					$('#inputview{rand}').html(ret.msg);
				}
			});
		},
		loadshow:function(da){
			this.fieldsarr 	= da.fieldsarr;
			this.moders 	= da.moders;
			var cans = {
				fieldsarr:da.fieldsarr,
				view:'inputview{rand}',
				data:da.data,
				moders:da.moders,
				modejs:da.modejs,
				store:da.store,
				num:this.num,
				mid:this.mid,
				cnum:this.cnum,
				funitid:this.funitid,
				filedata:da.filedata,
				subdata:da.subdata,
				isinput:true,
				saveparams:{},
				inputparams:params,
				onsuccess:function(){
					c.closetan();
				},
				onshow:function(){
					get('submit{rand}').disabled=false;
				}
			};
			if(this.mid==0)cans.data = this.data;
			
			this.inputobj	= new js.input.create(cans);
			if(this.istan())js.input.resize(this.num);
		},
		
	}
	js.initbtn(c);
});
</script>

<div align="center">
	
	<div id="inputtitle{rand}" style="padding:10px">tit</div>

	<div id="inputviews{rand}" style="padding:10px;max-width:560px;height:400px;overflow:auto"  class="rock-panel rock-border rock-radius">
		<div align="left" id="inputview{rand}"  style="max-width:400px;padding:10px">
			<div align="center"><i style="height:40px;width:40px" class="rock-loading"></i></div>
		</div>
	</div>
	
	<div style="margin-top:20px"><button clickevt="submit" id="submit{rand}" disabled style="width:150px" type="button" class="webbtn webbtn-big">保存</button></div>
	
	<div class="blank10"></div>
</div>